package com.mk.admin.controller;

import com.mk.admin.log.WriteLog;
import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.PayOrderVo;
import com.mk.admin.service.PayOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/a/adm/payOrder")
@Api(tags = "支付订单")
public class PayOrderController {
    @Autowired
    private PayOrderService payOrderService;

    @PostMapping("/select")
    @WriteLog("支付订单查询")
    public ResultDto select(@RequestBody PayOrderVo vo) {
        return payOrderService.select(vo);
    }

    @PostMapping("/add")
    @WriteLog("支付订单新增")
    public ResultDto add(@RequestBody PayOrderVo vo) {
        return payOrderService.add(vo);
    }


    @PostMapping("/update")
    @WriteLog("支付订单修改")
    public ResultDto update(@RequestBody PayOrderVo vo) {
        return payOrderService.update(vo);
    }

    @PostMapping("/payStatus")
    @WriteLog("支付订单支付状态修改")
    public ResultDto payStatus(@RequestBody PayOrderVo vo) {
        return payOrderService.payStatus(vo);
    }

    @PostMapping("/refund")
    @WriteLog("支付订单退款")
    @ApiOperation("自助开单处方退款")
    public ResultDto refund(@RequestBody PayOrderVo vo) {
        return payOrderService.refund(vo);
    }

    @PostMapping("/patientRefund")
    @WriteLog("支付订单退款")
    @ApiOperation("门诊已缴费订单退款")
    public ResultDto patientRefund(@RequestBody PayOrderVo vo) {
        return payOrderService.patientRefund(vo);
    }

    @PostMapping("/delete")
    @WriteLog("支付订单删除")
    public ResultDto delete(@RequestBody PayOrderVo vo) {
        return payOrderService.delete(vo.getId());
    }

    @PostMapping("/status")
    @WriteLog("支付订单状态")
    public ResultDto status(@RequestBody PayOrderVo vo) {
        return payOrderService.status(vo.getStatus());
    }
}
